<%@ page contentType="text/html; charset=UTF-8"%>
<%@page import="org.apache.shiro.web.filter.authc.FormAuthenticationFilter"%>
<%@page import="com.gljx.spring.manage.exception.IncorrectCaptchaException"%>
<%@page import="org.apache.shiro.authc.AuthenticationException"%>
<%@page import="org.apache.shiro.subject.Subject"%>
<%@page import="org.apache.shiro.SecurityUtils"%>
<%-- <%@page import="com.gljx.util.RSAUtil"%>
<%@page import="com.gljx.constant.Constant"%> --%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> 

<%
Subject subject = SecurityUtils.getSubject();
String userName =(String)subject.getPrincipal(); 
String remember ="";
 if(subject != null){
	if(subject.isRemembered()){
		remember = "Y";
	}else{
		if(subject.getPrincipal() != null){
			Cookie[] cookies = request.getCookies();
		    boolean cookieFlag = false;
		    //需要先判断是否有cookies如果有需要先删除再存入
		    if(cookies!=null){
		    	String rem = "";
		        for (Cookie cookie : cookies) {
		            if(cookie.getName().equals("rememberMe")){
		            	
		            	String flag = cookie.getValue();
		            	if(flag.equals("delete")){
		            		userName = "";
		            	}else{
		            		cookieFlag = true;
		            		remember = "Y";
		            	}
		            	break;
		            }
		        }
		    }
		    if(cookieFlag){
		    	userName = (String)subject.getPrincipal();
				remember = "Y";
		    }else{
		    	userName = "";
		    }
			
		}else{
			userName = "";
		}
	}
	
}
if(request.getAttribute("userName")!=null){
	userName = (String)request.getAttribute("userName");
} 
String password =""; 
if(request.getAttribute("password")!=null){
	password = (String)request.getAttribute("password");
}
if(request.getAttribute("remember")!=null){
	if(request.getAttribute("remember") == "true"){
		remember = "Y";
	}else{
		remember = "";
	}
}
%>